extends StaticBody2D

@onready var collision_shape_2d: CollisionShape2D = $CollisionShape2D
@onready var sprite_2d: Sprite2D = $Sprite2D

#func _ready() -> void:
	#var button :OrganButton= get_tree().get_first_node_in_group("button")
	#button.pressed.connect(_on_button_pressed)
	#button.released.connect(_on_button_released)


func _on_button_pressed(_body = null) -> void:
	var tween = create_tween()
	tween.tween_property(sprite_2d,"modulate:a",0.0,0.3).set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_CUBIC)
	collision_shape_2d.set_deferred("disabled", true)

func _on_button_released() -> void:
	var tween = create_tween()
	tween.tween_property(sprite_2d,"modulate:a",1.0,0.3).set_ease(Tween.EASE_IN_OUT).set_trans(Tween.TRANS_CUBIC)
	collision_shape_2d.set_deferred("disabled", false)
